package com.zl.basis.http;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.Arrays;

public final class ByteContentFile implements Parcelable {
    private String reqName;
    private String fileName;
    private byte[] content;

    public ByteContentFile() {
    }

    public ByteContentFile(String reqName, String fileName, byte[] content) {
        this.reqName = reqName;
        this.fileName = fileName;
        this.content = content;
    }

    public String getReqName() {
        return reqName;
    }

    public void setReqName(String reqName) {
        this.reqName = reqName;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public byte[] getContent() {
        return content;
    }

    public void setContent(byte[] content) {
        this.content = content;
    }

    @Override
    public String toString() {
        return "ByteContentFile{" +
                "reqName='" + reqName + '\'' +
                ", fileName='" + fileName + '\'' +
                ", content=" + Arrays.toString(content) +
                '}';
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.reqName);
        dest.writeString(this.fileName);
        dest.writeByteArray(this.content);
    }

    protected ByteContentFile(Parcel in) {
        this.reqName = in.readString();
        this.fileName = in.readString();
        this.content = in.createByteArray();
    }

    public static final Creator<ByteContentFile> CREATOR = new Creator<ByteContentFile>() {
        @Override
        public ByteContentFile createFromParcel(Parcel source) {
            return new ByteContentFile(source);
        }

        @Override
        public ByteContentFile[] newArray(int size) {
            return new ByteContentFile[size];
        }
    };
}
